package ex_class;

public class ReferenceExam {
	public static void change(int val) {
		val = 2;
	}
	
	public static void change(Car car) {
		car.name = "k5";
	}
	
	public static void change(String str) {
		str = "gaessaeng";
		//문자열을 변경시에는 변경된 문자열을 리턴해야
	}
	
	public static void main(String[] args) {
		int val = 1;
		int val2 = val;
		val2 = 2;
		
		System.out.println(val);
		
		Car pride = new Car();
		pride.name = "프라이드";
		Car pride2 = pride;
		pride2.name = "쟤네실수";
		
		System.out.println(pride.name);
		System.out.println(pride2.name);
		System.out.println("------------------------");
		
		System.out.println(val);
		change(val);
		System.out.println(val);
		
		System.out.println(pride.name);
		change(pride);
		System.out.println(pride.name);
	
		System.out.println("------------------------");
		
		String str = "abc";
		System.out.println(str);
		change(str);
		System.out.println(str);
		
	}
}
